package org.budo.cmbc.sdk.entity;

import java.util.ArrayList;
import java.util.List;

import org.budo.xml.XmlObject;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author lmw
 */
@Getter
@Setter
@ToString
public class QryBalResponse extends AbstractCmbcResponse {
    private static final long serialVersionUID = 2715415693129471185L;

    private List<BalInfo> balInfos;

    public QryBalResponse(String responseXml) {
        this.setResponseBody(responseXml);

        XmlObject xDataBody = this.xDataBody(responseXml);
        XmlObject balList = xDataBody.getChildNodeByName("balList");
        XmlObject[] balInfoArray = balList.getChildNodeArrayByName("balInfo");

        this.balInfos = new ArrayList<BalInfo>(balInfoArray.length);

        for (XmlObject balInfoObject : balInfoArray) {
            this.balInfos.add(new BalInfo(balInfoObject));
        }
    }
}